package cn.edu.njust.strategy;

import cn.edu.njust.server.Stat;

import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;

public class RoundRobinStrategy implements StatelessStrategy {
    private AtomicInteger current = new AtomicInteger(0);

    @Override
    public int next(List<Stat> stats, List<Integer> weights) {
        return current.getAndUpdate(val -> ++val % stats.size());
    }
}
